#ifndef SCRIPT_H
#define SCRIPT_H

#include "Core/base.h"
#include "Core/timestep.h"


namespace CC
{
    class Entity;
    class Scene;

    class Script
    {
    public:
        Script(std::string scriptname = ""): classname(scriptname) {}
        virtual ~Script() {}

        virtual void Update(Timestep ts){
            if(!isInit){
                isInit = true;
                Init();
            }
        }

        virtual void OnEvent(Event &e) {

        }

        virtual void Init(){
            CC_CORE_INFO("Script Init~~~~~~~~~~~~~~~~\n");
            CC_ASSERT(node != nullptr, "ASSERT Script Init. node = null\n");
        }

        virtual void onContactTest(Entity *current, Entity *other) {
            CC_ASSERT(current != nullptr && other != nullptr, "ASSERT Script onContactTest. one = null | two = null\n");
        }

        virtual void onNoContactTest() {

        }

        std::string classname;
        Entity *node = nullptr;
        Scene *scene = nullptr;

        bool isInit = false;
    };
}

#endif